package com.tansuo365.test1.controller.othercontrol;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tansuo365.test1.bean.kucunbean.ChukuZhixing;
import com.tansuo365.test1.service.kucunservice.ChukuZhixingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 出库退库执行汇总
 * 对应数据库表 :wuliaochukudanmingxihuizong
 *
 */

@RequestMapping("/admin/chukuzhixing")
@RestController
public class ChukuZhixingController {
    @Autowired
    private ChukuZhixingService chukuZhixingService;

    //用量查询
    @RequestMapping("/getSelective")
    public Map<String,Object> getZhixing(ChukuZhixing chukuZhixing, @RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "rows", required = true) Integer rows){
        if(chukuZhixing==null){
            return null;
        }
        Map<String, Object> resultMap = new HashMap<>();
        PageHelper.startPage(page, rows);
        List<ChukuZhixing> chukuZhixingList = chukuZhixingService.listChukuZhixingSelective(chukuZhixing);
        PageInfo<ChukuZhixing> pageInfo = new PageInfo<>(chukuZhixingList);
        resultMap.put("rows", pageInfo.getList());
        resultMap.put("total", pageInfo.getTotal());
        return resultMap;
    }
}
